package com.saic.utils;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

public class TaskPool {
	public static ThreadPoolExecutor executors;
	static {
		ExecutorService executor = Executors.newCachedThreadPool();
		executors = (ThreadPoolExecutor) executor;
		executors.setCorePoolSize(100);
		executors.setMaximumPoolSize(100);
		executors.allowCoreThreadTimeOut(true);
		executors.setKeepAliveTime(1, TimeUnit.SECONDS);
	}
	/**
	 * add task to threadPool ,
	 * @param task
	 */
	public static void putTaskToPool(Runnable task) {
		executors.execute(task);
	}

}
